<?php $this->load->view('header'); ?>
<?php $this->load->view('menus'); ?>

<br />
<table border="1">
	<thead>
	<tr>
		<th>Username</th>
		<th>Name</th>
		<th>Role</th>
		<th>Actions</th>
	</tr></thead>
	<tbody>	
<? foreach( $this->Accounts->fetch_all() as $account ) { ?>
	<tr>
		<td><a href="<?=site_url('account/view/id/'.$account->account_id);?>"><?=$account->user?></a></td>
		<td><?=$account->first_name?> <?=$account->last_name?></td>
		<td>
			<? if($account->is_admin) { ?>
				Administrator
			<? } else if($account->is_manager) { ?>
				Manager
			<? } else { ?>
				Utilizator
			<? } ?>
		</td>
		<td>
			<? if( $this->Account->is_admin() ) { ?>
			<a href="<?=site_url('account/remove/id/'.$account->account_id);?>">
				Delete</a>	- 
			<a href="<?=site_url('account/manager/id/'.$account->account_id);?>">
				<? if($account->is_manager) { ?>
				Not Manager	
				<? } else { ?>
				Manager
				<? } ?>
				</a>
			<? } ?>
		</td>
	</tr>
<? } ?>
	</tbody>
</table>

<?php $this->load->view('footer'); ?>
